﻿/*
 * @Autor: PK
 * @Date: 2022/01/25 14:24:SS
 */

using System;
using System.Collections.Generic;
using Z.Expressions;

namespace ShkSimulation.core.util {

	public static class MathUtil {

		public static (bool, double) Execute(string formula, Dictionary<string, double> targetValues) {
			try {
				return (true, Eval.Execute<double>(formula, targetValues));
			} catch (Exception e) {
				Console.WriteLine(e);
				return (false, Double.NaN);
			}
		}

	}

}